配置從節點1
1、vi /elasticsearch/conf/elasticsearch.yml
cluster.name: elastic-cluster
node.name: slave1
path.data: /usr/local/soft/elasticsearch-slave1/data/
path.logs: /usr/local/soft/elasticsearch-slave1/logs/
bootstrap.memory_lock: true
network.host: 192.168.162.72
http.port: 9201
//主節點地址,若有多個,則配置多個
discovery.zen.ping.unicast.hosts: ["192.168.162.72"]
http.cors.enabled: true
http.cors.allow-origin: "*"
2、啟動服務 -d 后臺啟動
./elasticsearch/bin/elasticsearch -d?
配置從節點2
1、vi /elasticsearch/conf/elasticsearch.yml
cluster.name: elastic-cluster
node.name: slave2
path.data: /usr/local/soft/elasticsearch-slave2/data/
path.logs: /usr/local/soft/elasticsearch-slave2/logs/
bootstrap.memory_lock: true
network.host: 192.168.162.72
http.port: 9202
//主節點地址,若有多個,則配置多個
discovery.zen.ping.unicast.hosts: ["192.168.162.72"]
http.cors.enabled: true
http.cors.allow-origin: "*"
2、啟動服務 -d 后臺啟動
./elasticsearch/bin/elasticsearch -d?
配置jvm.options
默認配置
-Xms2g
-Xmx2g
當系統內存不足時,需要調小這個值。否則啟動多個節點時,由于內存不足,om會自動kill掉進程。
-Xms512m
-Xmx512m
配置elasticsearch-head(es可視化界面)
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
open http://localhost:9100/
注意:
?當啟動主點后,端口9200和9300同時啟動
9200作為Http協議,節點和外部通訊,調用restful接口用9200。
9300作為Tcp協議,ES集群節點之間的通訊使用。